
import gtk
import hippo

class Main:

    def __init__(self):
        #self.window = hippo.CanvasWindow()
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)

        if 0:
            self.button = gtk.Button("Hello World")
            self.button.connect("clicked", self.hello, None)
            self.button.connect_object("clicked", gtk.Widget.destroy, self.window)
            self.window.add(self.button)
            self.button.show()

        if 1:
            canvas = hippo.Canvas()

            box = hippo.CanvasBox(orientation=hippo.ORIENTATION_HORIZONTAL, border=3)
            text = hippo.CanvasText(text=u"Hello, World", xalign=hippo.ALIGNMENT_START, size_mode=hippo.CANVAS_SIZE_ELLIPSIZE_END)
            box.append(text)
            box.append(hippo.CanvasLink(text="Foo!"))
                
            canvas.set_root(box)
            self.window.add(canvas)
            canvas.show()
        
        self.window.show()

    def hello(self, widget, data=None):
        print "FOO"
   
    def delete_event(self, widget, event, data=None):
        return True
    
    def destroy(self, widget, data=None):
        gtk.main_quit()
             

a = Main()
gtk.main()
